package com.hsxc.cdz.base.dao;

import org.apache.log4j.Logger;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.hsxc.cdz.base.bean.Reserv;

import java.util.List;

@Repository("reservDao")
public class ReservDao {

	protected static Logger logger = Logger.getLogger("BillDao");
	//自动注入SqlSessionTemplate类的实例
	@Autowired  
	private SqlSessionTemplate sqlSessionTemplate;
	
	/**
	 * 创建预约
	 * @param reserv
	 * @return
	 */
	public int insertReserv(Reserv reserv){
		return sqlSessionTemplate.insert("insertReserv", reserv);
	}
	/**
	 * 根据用户名查看去预约信息
	 * @param reserv
	 * @return
	 */
	public List<Reserv> selectReserv(Reserv reserv){
		return sqlSessionTemplate.selectList("selectReserv", reserv);
	}
	public Reserv selReservByNo(Reserv reserv){
		return sqlSessionTemplate.selectOne("selectReserv",reserv);
	}
	/**
	 * 删除预约
	 * @param reserv
	 * @return
	 */
	public int deleteResev(Reserv reserv){
		return sqlSessionTemplate.delete("deleteReserv", reserv);
	}
	/**
	 * 根性预约信息
	 * @param reserv
	 * @return
	 */
	public int updateReserv(Reserv reserv){
		return sqlSessionTemplate.update("updateReserv",reserv);
	}
}
